home *** CD-ROM | disk | FTP | other *** search
/ Workbench Design / WB Collection.iso / datatypes / debox_dt / source / check.c < prev    next >
C/C++ Source or Header  |  1996-04-07  |  2KB  |  67 lines

  1.  
  2. /******************************************************************************
  3.  *
  4.  * Flowerpower's DeBox Datatype
  5.  *
  6.  * Written by Christian Buchner and David N. Junod
  7.  *
  8.  ******************************************************************************
  9.  * check.c
  10.  *
  11.  */
  12.  
  13. #include <exec/types.h>
  14. #include <dos/dos.h>
  15. #include <dos/dosextens.h>
  16. #include <datatypes/datatypes.h>
  17. #include <graphics/gfx.h>
  18.  
  19. #include <clib/exec_protos.h>
  20. #include <clib/dos_protos.h>
  21. #include <clib/utility_protos.h>
  22.  
  23. #include <pragmas/exec_pragmas.h>
  24. #include <pragmas/dos_pragmas.h>
  25. #include <pragmas/utility_pragmas.h>
  26.  
  27. #include "classbase.h"
  28.  
  29. /*****************************************************************************/
  30.  
  31. #undef SysBase
  32. #define SysBase          dthc->dthc_SysBase
  33. #undef DOSBase
  34. #define DOSBase          dthc->dthc_DOSBase
  35. #undef UtilityBase
  36. #define UtilityBase      dthc->dthc_UtilityBase
  37.  
  38. /*****************************************************************************/
  39.  
  40. BOOL __asm DTHook (register __a0 struct DTHookContext * dthc)
  41. {
  42.     BOOL retval = FALSE;
  43.     struct DeBoxChunk *chunk;
  44.     
  45.     /* Make sure we have a FileInfoBlock */
  46.     if (dthc->dthc_FIB)
  47.     {
  48.         /* Make sure we have a buffer */
  49.         if (dthc->dthc_Buffer && dthc->dthc_BufferLength>=sizeof(struct DeBoxChunk))
  50.         {
  51.             /* The buffer is the DeBoxChunk */
  52.             chunk=(struct DeBoxChunk*)dthc->dthc_Buffer;
  53.             
  54.             /* Check file size */
  55.             if (dthc->dthc_FIB->fib_Size==sizeof(struct DeBoxChunk)+chunk->chunk_len)
  56.             {
  57.                 /* Check header CRC */
  58.                 if (DeBoxCRC(chunk))
  59.                 {
  60.                     retval=TRUE;
  61.                 }
  62.             }
  63.         }
  64.     }
  65.     return(retval);
  66. }
  67.